package com.taobao.wolfwolf.hibernate.dao.impl;

import java.util.List;

import com.taobao.wolfwolf.hibernate.dao.OrderDao;
import com.taobao.wolfwolf.hibernate.pojo.Order;

@SuppressWarnings("unchecked")
public class OrderDaoImpl extends BaseDaoImpl implements OrderDao {

	public Order findById(int id) throws Exception {
		return (Order) getHibernateTemplate().get(Order.class, id);
	}
	
	public List<Order> findByName(String name) throws Exception {
		return super.findByProperty(Order.class, "name", name);
	}

	public List<Order> findAll() throws Exception {
		return getHibernateTemplate().find("from Order");
	}

	public long getTotal() throws Exception {
		return super.countByCriteria(Order.class);
	}

	public List<Order> paging(int page, int limit) throws Exception {
		return super.findByCriteriaByPage(Order.class, page, limit);
	}
}
